﻿@model IEnumerable<CongressVote.Models.Users>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<p>
    @Html.ActionLink("Create New", "CreateAdmin")
</p>
<p>
    @Html.ActionLink("Create New", "CreateRepresentative")
</p>
<p>
    @Html.ActionLink("Create New", "CreateSenator")
</p>
<table>
    <tr>
        <th>
            User_Type
        </th>
        <th>
            name
        </th>
        <th>
            userName
        </th>
        
        <th>
            District
        </th>
        <th>
            State
        </th>
        <th>
            Party
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td style="border:solid 2px black">
            @if(item.User_Type == 1)
            {
                @Html.Label("Representative")
            }
            else if(item.User_Type == 2)
            {
                @Html.Label("Senator")
            }
            else if(item.User_Type == 3)
            {
                @Html.Label("Admin")
            }
            
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.userName)
        </td>
        
        <td>
            @Html.DisplayFor(modelItem => item.District.name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.State.name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Party.name)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.id }) |
            @Html.ActionLink("Details", "Details", new { id=item.id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.id })
        </td>
    </tr>
}

</table>
